home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 4
/
The Arsenal Files 4 (Arsenal Computer).ISO
/
clarion
/
disabl.exe
/
CONTA002.CLW
< prev
next >
Wrap
Text File
|
1995-01-04
|
9KB
|
253 lines
MEMBER('CONTACTS.clw') ! This is a MEMBER module
UpdateProc PROCEDURE
LocalRequest LONG,AUTO
OriginalRequest LONG,AUTO
LocalResponse LONG,AUTO
WindowOpened LONG
WindowInitialized LONG
ForceRefresh LONG,AUTO
ActionMessage CSTRING(40)
RecordChanged BYTE,AUTO
SAV::CON:Record STRING(SIZE(CON:Record))
SAV::CON:Remarks STRING(SIZE(CON:Remarks))
FormWindow WINDOW('Update Records...'),AT(10,2,305,170),FONT('Arial',10,,),CENTER,SYSTEM,GRAY,MDI
ENTRY(@s4),AT(52,3,29,12),USE(CON:ID)
ENTRY(@s20),AT(52,23,,),USE(CON:FirstName)
ENTRY(@s20),AT(200,23,,),USE(CON:LastName)
ENTRY(@s25),AT(52,42,,),USE(CON:Company)
ENTRY(@s25),AT(52,62,,),USE(CON:Address1)
ENTRY(@s25),AT(52,83,,),USE(CON:Address2)
ENTRY(@s2),AT(209,83,,),USE(CON:State)
ENTRY(@s5),AT(259,83,,),USE(CON:Zip)
ENTRY(@s25),AT(52,102,,),USE(CON:City)
ENTRY(@p##/##/##p),AT(235,103,,),MSG('Date lead was received'),USE(CON:DateLead),OVR
ENTRY(@p(###) ###-####p),AT(52,121,,),USE(CON:Phone)
ENTRY(@p(###) ###-####p),AT(52,138,,),USE(CON:Fax)
ENTRY(@s25),AT(157,121,,),USE(CON:JobTitle)
TEXT,AT(157,138,56,12),MSG('Status of lead'),USE(CON:Status),CAP
BUTTON('OK'),AT(28,155,40,12),USE(?OK),DEFAULT
PROMPT('ID:'),AT(38,4,,),USE(?CON:ID:Prompt)
PROMPT('&First Name:'),AT(5,24,,),USE(?CON:FirstName:Prompt)
PROMPT('&Last Name:'),AT(154,24,,),USE(?CON:LastName:Prompt)
PROMPT('&Company:'),AT(10,44,,),USE(?CON:Company:Prompt)
PROMPT('Date of Lead:'),AT(185,105,,),USE(?CON:DateLead:Prompt)
PROMPT('&Address 1:'),AT(8,64,,),USE(?CON:Address1:Prompt)
PROMPT('&Address 2:'),AT(8,84,,),USE(?CON:Address2:Prompt)
PROMPT('&Zip:'),AT(240,84,,),USE(?CON:Zip:Prompt)
PROMPT('&State:'),AT(183,84,,),USE(?CON:State:Prompt)
PROMPT('&City:'),AT(28,104,,),USE(?CON:City:Prompt)
PROMPT('&Job Title:'),AT(119,124,,),USE(?CON:JobTitle:Prompt)
PROMPT('&Phone:'),AT(20,124,,),USE(?CON:Phone:Prompt)
PROMPT('&Fax:'),AT(28,138,,),USE(?CON:Fax:Prompt)
PROMPT('Status:'),AT(126,139,25,10),USE(?CON:Status:Prompt)
BUTTON('Cancel'),AT(73,155,40,12),USE(?Cancel)
STRING(@S40),AT(118,155,,),USE(ActionMessage)
END
CODE
LocalRequest = GlobalRequest
OriginalRequest = GlobalRequest
LocalResponse = RequestCancelled
CLEAR(GlobalRequest)
CLEAR(GlobalResponse)
SAV::CON:Record = CON:Record
SAV::CON:Remarks = CON:Remarks
IF LocalRequest = InsertRecord
DO PrimeFields
END
IF Status::Used = 0
CheckOpen(Status,1)
END
Status::Used += 1
IF contacts::Used = 0
CheckOpen(contacts,1)
END
contacts::Used += 1
OPEN(FormWindow)
WindowOpened=True
CASE LocalRequest
OF InsertRecord
ActionMessage = 'Record will be Added'
OF ChangeRecord
ActionMessage = 'Record will be Changed'
OF DeleteRecord
ActionMessage = 'Record will be Deleted'
END
ACCEPT
CASE EVENT()
OF EVENT:CloseWindow
IF LocalResponse <> RequestCompleted
RecordChanged = False
IF LocalRequest = InsertRecord OR LocalRequest = ChangeRecord
IF SAV::CON:Record <> CON:Record |
OR SAV::CON:Remarks <> CON:Remarks
RecordChanged = True
END
END
IF RecordChanged
CASE StandardWarning(Warn:ConfirmCancel)
OF Button:Yes
SELECT()
CYCLE
OF Button:No
OF BUTTON:Cancel
SELECT(?CON:ID)
CYCLE
END
END
END
DO RefreshWindow
OF EVENT:CloseDown
IF LocalResponse <> RequestCompleted
RecordChanged = False
IF LocalRequest = InsertRecord OR LocalRequest = ChangeRecord
IF SAV::CON:Record <> CON:Record |
OR SAV::CON:Remarks <> CON:Remarks
RecordChanged = True
END
END
IF RecordChanged
CASE StandardWarning(Warn:ConfirmCancel)
OF Button:Yes
LocalResponse = RequestCompleted
SELECT()
CYCLE
OF Button:No
OF BUTTON:Cancel
SELECT(?CON:ID)
CYCLE
END
END
END
DO RefreshWindow
OF EVENT:OpenWindow
IF NOT WindowInitialized
DO InitializeWindow
END
SELECT(?CON:ID)
OF EVENT:GainFocus
WindowInitialized = True
DO InitializeWindow
ELSE
IF EVENT() = Event:Completed
CASE LocalRequest
OF InsertRecord
ADD(contacts)
CASE ERRORCODE()
OF NoError
LocalResponse = RequestCompleted
POST(Event:CloseWindow)
OF DupKeyErr
IF DUPLICATE(CON:ID_Key)
IF StandardWarning(Warn:DuplicateKey,'CON:ID_Key')
SELECT(?CON:ID)
CYCLE
END
END
ELSE
IF StandardWarning(Warn:InsertError)
SELECT(?CON:ID)
CYCLE
END
END
OF ChangeRecord
LOOP
LocalResponse = RequestCancelled
SETCURSOR(Cursor:Wait)
IF RIUpdate:contacts(SAV::CON:Record)
SETCURSOR()
CASE StandardWarning(Warn:UpdateError)
OF Button:Yes
CYCLE
OF Button:No
POST(Event:CloseWindow)
BREAK
OF Button:Cancel
SELECT(?CON:ID)
BREAK
END
ELSE
SETCURSOR()
LocalResponse = RequestCompleted
POST(Event:CloseWindow)
END
BREAK
END
OF DeleteRecord
LOOP
LocalResponse = RequestCancelled
SETCURSOR(Cursor:Wait)
IF RIDelete:contacts()
SETCURSOR()
CASE StandardWarning(Warn:DeleteError)
OF Button:Yes
CYCLE
OF Button:No
POST(Event:CloseWindow)
BREAK
OF Button:Cancel
SELECT(?CON:ID)
BREAK
END
ELSE
SETCURSOR()
LocalResponse = RequestCompleted
POST(Event:CloseWindow)
END
BREAK
END
END
END
END
CASE FIELD()
OF ?OK
CASE EVENT()
OF EVENT:Accepted
DO SyncWindow
IF OriginalRequest = ChangeRecord OR OriginalRequest = InsertRecord
SELECT()
ELSE
POST(EVENT:Completed)
END
DO RefreshWindow
END
OF ?Cancel
CASE EVENT()
OF EVENT:Accepted
DO SyncWindow
LocalResponse = RequestCancelled
POST(Event:CloseWindow)
DO RefreshWindow
END
END
END
Status::Used -= 1
IF Status::Used = 0 THEN CLOSE(Status).
contacts::Used -= 1
IF contacts::Used = 0 THEN CLOSE(contacts).
IF WindowOpened
CLOSE(FormWindow)
END
IF LocalResponse
GlobalResponse = LocalResponse
ELSE
GlobalResponse = RequestCancelled
END
RETURN
!---------------------------------------------------------------------------
InitializeWindow ROUTINE
ForceRefresh = True
DO RefreshWindow
!---------------------------------------------------------------------------
RefreshWindow ROUTINE
DISPLAY()
ForceRefresh = False
!---------------------------------------------------------------------------
SyncWindow ROUTINE
!---------------------------------------------------------------------------
PrimeFields ROUTINE
CON:Record = SAV::CON:Record
CON:Remarks = SAV::CON:Remarks
SAV::CON:Record = CON:Record
SAV::CON:Remarks = CON:Remarks